Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WTrackProperty: show simple editor on delayed double-click #11755

Merged
merged 4 commits into from
Apr 3, 2024

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Jul 22, 2023

show a simple QLineEdit after selected-click (delayed double click) onto track property labels

a coffee break project to help with my tag editing workflow (quick in-deck tag editing), i.e. create a fast alternative to double-click -> Track Properties -> click desired property line edit -> edit -> hit Apply:

Gonna share this early, but Draft until it's polished.
track-label-edit-2

  • styles for line edit
  • get real double-click interval, use x3 for selected click 2s timeout are fine
  • use timer, reset 'selected' state automatically
  • visual feedback for 'selected' state (while widget expects second click):
    new selected widget property, WTrackProperty[selected="true"] { background: red; };
  • add selected-click info to tooltips

May reuse #11752 for comments, but QLineEdit is fine for now.

@ronso0
Copy link
Member Author

ronso0 commented Jul 25, 2023

I'll probably keep polishing this, but it has already proven useful & usable in real life.

@ronso0
Copy link
Member Author

ronso0 commented Jul 26, 2023

This is very inviting, I edit and tag my tracks much more often now, and more spontaneously than before, when editing was rather clunky with Track Info or with the library.
(#11764 definitely helps, but this is way easier. )

@ronso0
Copy link
Member Author

ronso0 commented Aug 16, 2023

Ready to roll!

There's a new tr string for the respective tooltip.

@ronso0 ronso0 marked this pull request as ready for review August 16, 2023 12:34
@ronso0
Copy link
Member Author

ronso0 commented Sep 20, 2023

I added a workaround a Qt bug that became obvious with the new hover styles:
hover gets stuck when the track menu is opened which is kind of irritating. The hover state can only be reset by hovering the widget again after closing the menu.

Workaround is to post a QLeaveEvent when the menu is shown.

Need to test whether this is still required with Qt6.

@ronso0
Copy link
Member Author

ronso0 commented Oct 15, 2023

rebased onto main

@ronso0 ronso0 force-pushed the track-label-editor branch 2 times, most recently from 6f82aad to 2239f22 Compare October 20, 2023 08:27
@ronso0
Copy link
Member Author

ronso0 commented Oct 20, 2023

I added a workaround a Qt bug that became obvious with the new hover styles: hover gets stuck when the track menu is opened which is kind of irritating. The hover state can only be reset by hovering the widget again after closing the menu.

Workaround is to post a QLeaveEvent when the menu is shown.

Need to test whether this is still required with Qt6.

Yes, it is.

I also improved some comments. Ready for review.

@ronso0
Copy link
Member Author

ronso0 commented Dec 25, 2023

this is now based on #12004
rebased onto main

@ronso0 ronso0 force-pushed the track-label-editor branch 2 times, most recently from 57a9196 to 8351e4f Compare January 3, 2024 01:33
@ronso0 ronso0 force-pushed the track-label-editor branch 2 times, most recently from e3732be to 71a7625 Compare February 12, 2024 00:06
@ronso0
Copy link
Member Author

ronso0 commented Mar 29, 2024

This works great, except: clicking outside the editor ('blank' area) doesn't close it.
Related: #12966 (comment))

@ronso0
Copy link
Member Author

ronso0 commented Mar 31, 2024

Very strange: after rebasing (main with new drag'n'drop threshold) hovering a WTrackProperty initiates a drag. THOUGH this is not caused by c++ changes but by qss selector WTrackProperty:hover.
🤷

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works good. I have only two minor comments

namespace {
// Duration (ms) the widget is 'selected' after left click, i.e. the duration
// a second click would open the value editor
constexpr int selectedClickTimeout = 2000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
constexpr int selectedClickTimeout = 2000;
constexpr int kSelectedClickTimeoutMs = 2000;


if (!m_pSelectedClickTimer) {
// create & start the timer
m_pSelectedClickTimer = new QTimer(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also become a parented pointer.

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you.

* load a track
* click a track label -> is now 'selected' (qProperty for qss)
* click again within 2 sec
* editor is created
* edit text
* to cancel: press Esc to cancel
* to apply & close: press Return or focus another widget
* hover effect
* 'selected' state (waiting for second click to start editing)
* editor

Note: Shade has no hover effects (at all)
@ronso0
Copy link
Member Author

ronso0 commented Apr 2, 2024

I squashed the fixup.

@daschuer daschuer merged commit 210c739 into mixxxdj:main Apr 3, 2024
13 checks passed
@daschuer
Copy link
Member

daschuer commented Apr 3, 2024

Thank you.

@ronso0 ronso0 deleted the track-label-editor branch April 3, 2024 09:56
@ronso0
Copy link
Member Author

ronso0 commented Apr 3, 2024

Wooohoo 🎉
Thanks for reviewing @daschuer

@ronso0
Copy link
Member Author

ronso0 commented Apr 16, 2024

Review after having used this for a few months:
quite often I expected the editor to open after the first click (select), probably due to the hover effect.
I'll check if I can make it act on first click and while leaving drag'n'drop as is.

And I expect the cursor at the front of the selection to match watch the label displayed (even if that is different to how line edits usually behave).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable editable track metadata in decks with 'selected click' lineedits
2 participants